package com.eeepay.eeepay_v2.adapter;


import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.util.Log;

import com.eeepay.eeepay_v2.R;
import com.eeepay.eeepay_v2.model.PaperFile;
import com.eeepay.eeepay_v2.model.PapersInfo;
import com.eeepay.eeepay_v2.util.BitmapUtils;
import com.eeepay.eeepay_v2.util.FileUtil;
import com.eeepay.v2_library.adapter.ABBaseAdapter;
import com.eeepay.v2_library.adapter.ABViewHolder;
import com.eeepay.v2_library.bitmap.Bimp;
import com.eeepay.v2_library.util.ImageLoaderUtils;

import java.io.File;

/**
 * Created by Administrator on 2016/4/2514:52.
 */
public class PaperAdapter extends ABBaseAdapter<PaperFile> {

    public PaperAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_papers_girdview;
    }

    @Override
    public void convert(ABViewHolder holder, PaperFile model) {
//        holder.setText(R.id.tv_fileName, model.getTipName());
//        holder.setImageResource(R.id.iv_demand, model.getTipImage());
//        if (model.getFilePath() != null) {
//            Bitmap bitmap = Bimp.compressBitmap(model.getFilePath(), 140, 140);
//            holder.setBitmap(R.id.iv_demand, bitmap);
//        }
        holder.setText(R.id.tv_fileName, model.getTipName());
        if (model.getFilePath() == null) {
            holder.setImageResource(R.id.iv_demand, model.getTipImage());
        } else {
            Bitmap bitmap = Bimp.compressBitmap(model.getFilePath(), 140, 140);
            Log.d("holder","filePath:"+model.getFilePath());//+"  ||   bitmap:"+ bitmap.toString()
            holder.setBitmap(R.id.iv_demand, bitmap);
        }
//        if (model.getBitmap() == null) {
//            holder.setImageResource(R.id.iv_demand, model.getTipImage());
//        } else {
//            holder.setBitmap(R.id.iv_demand, model.getBitmap());
//        }
    }
}
